package com.xiyi.shouxin.conf;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.lang.NonNull;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

import com.xiyi.shouxin.interceptor.AuthInterceptor;

@Configuration
public class WebConfig implements WebMvcConfigurer {
    @Autowired
    private AuthInterceptor authInterceptor;

    @Override
    public void addInterceptors(@NonNull InterceptorRegistry registry) {
        registry.addInterceptor(authInterceptor)
                .addPathPatterns("/**")
                .excludePathPatterns(ProjectConfig.getBasePath()+"/upload/**")
                .excludePathPatterns("/upload/**")
                .excludePathPatterns(ProjectConfig.getBasePath()+"/echo/**")
                .excludePathPatterns("/echo/**")
                .excludePathPatterns("/admin/login", "/user/wx_code_login","/config/get_config","/user/sendSms","/user/loginBySmsCode","/user/register");
    }

}
